#pragma once

class Texture
{
public:
    Texture();
    Texture(glm::ivec2 & dim, GLint internalFormat, GLenum inputFormat, GLenum inputType, GLint filter, GLint wrap, const void* data);
    virtual ~Texture();

    void bind () const;
    void unbind () const;
    glm::ivec2 getDim() const { return dim; }    
    GLuint get() const { return texId; }
    //const cl::Image2DGL& getCL() const { return clTexId; } 
private:
    glm::ivec2 dim;
    GLuint texId;
    bool created;
    bool clInterop;
    //cl::Image2DGL clTexId;
};

class PingPongTexture {
public:
	PingPongTexture(glm::ivec2 & dim, GLint internalFormat, GLenum inputFormat, GLenum inputType, GLint filter, GLint wrap, const void* data);
	PingPongTexture();
	void swap() { current_id = (current_id+1) % 2; };
	GLuint In () const { return tex_id[current_id]; }
	GLuint Out () const { return tex_id[(current_id+1) % 2]; }
	/*void bind () const;
	void unbind () const;*/
	glm::ivec2 getDim() const { return dim; }    

private:
	glm::ivec2 dim;
	GLuint tex_id[2];
	int current_id;
	bool created;
};